How To Open Ports via WHM or Command Line
This article will explain how you can open ports for your server in CSF.
⚠️ Please be aware that opening ports on your server can be a security risk, please be aware of any risks when opening a specific port on your server.
There are 2 different ways to open ports on your server. One way is through WHM and one is via command line.
Steps to open ports in WHM
-
Log in to your WHM: SERVER-IP/WHM
-
Click “ConfigServer Security & Firewall,” which is under the “Plugins” section
-
Go to "Firewall Configuration"
-
Find "TCP_IN=" under "IPv4 Port Settings"
-
Enter the port number in the list below. Make sure to separate ports with a single comma and do not enter any spaces.
-
Click "Change" at the bottom of the page.
This will reset the firewall so that the ports that you have opened will take effect.
Steps to open ports via command line
-
SSH into your server.
-
Go to the directory with the CSF configuration file.
-
Open the file "csf.conf"
-
Once you are in the configuration file, find "TCP_IN=", it will be under "# Allow incoming TCP ports"
-
Within the quotation marks, put the port number that you wish to open. Separate each IP using a single comma and no spaces.
-
Close the file and save all changes.
-
Restart the firewall.